{% extends 'base.html' %}
{% load viewflow %}

{% block title %}
Task List
{% endblock %}

{% block main_content %}
<div class="box box-primary">
    <div class="box-header with-border">
        <i class="fa fa-black-tie"></i>
        <h3 class="box-title">My Tasks</h3>
    </div>
    <div class="box-body">
        {% if task_list %}
        <table class="table table-bordered ">
            <thead>
                <tr>
                    <th>Reference</th>
                    <th>Created At</th>
                    <th>Details </th>
                    <th>Comments</th>
                </tr>
            </thead>
            <tbody>

                {% for task in task_list %}
                {% flowurl task user=request.user as task_url %}
                <tr>
                    <td>
                        {% if task_url %}
                        <a href="{{ task_url }}">{{ task.process.pk }}/{{ task.pk }}</a>
                        {% else %}
                        {{ task.process.pk }}/{{ task.pk }}
                        {% endif %}
                    </td>
                    <td>{{ task.created }}</td>
                    <td>{{ task.flow_process }}</td>
                    <td>{{ task.comments }}</td>
                </tr>
                {% endfor %}

            </tbody>
        </table>
        {% else %}
        <p>
            No tasks !
        </p>
        {% endif %}
    </div>
    <div class="box-footer">
        <a href="{% url 'example:index' %}" class="btn btn-default">
            <span class="glyphicon glyphicon-home"></span> Home
        </a>        
    </div>
</div>
{% endblock main_content %}